{"ast":null,"code":"import _objectSpread from\"/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/@babel/runtime/helpers/esm/objectSpread2.js\";import React from'react';import classNames from\"classnames\";import{getUserName}from\"../../utils/User\";import{Avatar,Name}from\"../index\";import{observer}from\"mobx-react-lite\";import{Context}from\"../../index\";import'./UserItem.scss';import{jsx as _jsx}from\"react/jsx-runtime\";import{jsxs as _jsxs}from\"react/jsx-runtime\";import{Fragment as _Fragment}from\"react/jsx-runtime\";var UserItem=function UserItem(props){var _React$useContext=React.useContext(Context),store=_React$useContext.store;if(props.profile.id){return/*#__PURE__*/_jsxs(\"div\",{className:classNames('users__item',{'users__item--online':true,'users__item--active':store.getViewedUserProfileId()===props.profile.id}),onClick:function onClick(){if(store.getViewedUserProfileId()===props.profile.id){store.setViewedUserProfileId(null);}else{store.setViewedUserProfile(_objectSpread(_objectSpread({},store.getViewedUserProfile()),props.profile));store.setViewedUserProfileId(props.profile.id);}},children:[/*#__PURE__*/_jsx(\"div\",{className:\"users__item--avatar\",children:/*#__PURE__*/_jsx(Avatar,{contentList:props.profile.content,alt:getUserName(props.profile),stringForFirstCharacter:getUserName(props.profile),stringForGenerateColor:props.profile.id})}),/*#__PURE__*/_jsxs(\"div\",{className:\"users__item-info\",children:[/*#__PURE__*/_jsx(\"div\",{className:\"users__item-info-top\",children:/*#__PURE__*/_jsx(\"p\",{className:\"users__item-name\",children:/*#__PURE__*/_jsx(Name,{user:props.profile,multiChat:false})})}),/*#__PURE__*/_jsx(\"div\",{className:\"users__item-info-bottom\",children:/*#__PURE__*/_jsx(\"p\",{children:props.profile.nickname})})]})]});}else{return/*#__PURE__*/_jsx(_Fragment,{});}};export default observer(UserItem);","map":{"version":3,"names":["React","classNames","getUserName","Avatar","Name","observer","Context","UserItem","props","useContext","store","profile","id","getViewedUserProfileId","setViewedUserProfileId","setViewedUserProfile","getViewedUserProfile","content","nickname"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/src/components/UserItem/index.tsx"],"sourcesContent":["import React from 'react';\nimport {UserItemProps} from \"../../models/props/UserItemProps\";\nimport classNames from \"classnames\";\nimport {getUserName} from \"../../utils/User\";\nimport {Avatar, Name} from \"../index\";\nimport {observer} from \"mobx-react-lite\";\nimport {Context} from \"../../index\";\nimport './UserItem.scss';\n\nconst UserItem: React.FC<UserItemProps> = (props) => {\n    const {store} = React.useContext(Context);\n\n    if (props.profile.id) {\n        return (\n            <div\n                className={classNames('users__item', {\n                    'users__item--online' : true,\n                    'users__item--active':\n                        store.getViewedUserProfileId() === props.profile.id\n                })}\n                onClick={() => {\n\n                    if (store.getViewedUserProfileId() === props.profile.id) {\n                        store.setViewedUserProfileId(null);\n                    } else {\n                        store.setViewedUserProfile({\n                            ...store.getViewedUserProfile(),\n                            ...props.profile\n                        });\n                        store.setViewedUserProfileId(props.profile.id);\n                    }\n                }}\n            >\n                <div className=\"users__item--avatar\">\n                    <Avatar\n                        contentList={props.profile.content}\n                        alt={getUserName(props.profile)}\n                        stringForFirstCharacter={getUserName(props.profile)}\n                        stringForGenerateColor={props.profile.id}\n                    />\n                </div>\n                <div className=\"users__item-info\">\n                    <div className=\"users__item-info-top\">\n                        <p className='users__item-name'>\n                            <Name user={props.profile} multiChat={false} />\n                        </p>\n                    </div>\n                    <div className='users__item-info-bottom'>\n                        <p>{props.profile.nickname}</p>\n                    </div>\n                </div>\n            </div>\n        );\n    } else {\n        return (<></>);\n    }\n}\n\nexport default observer(UserItem);"],"mappings":"6IAAA,MAAOA,MAAK,KAAM,OAAO,CAEzB,MAAOC,WAAU,KAAM,YAAY,CACnC,OAAQC,WAAW,KAAO,kBAAkB,CAC5C,OAAQC,MAAM,CAAEC,IAAI,KAAO,UAAU,CACrC,OAAQC,QAAQ,KAAO,iBAAiB,CACxC,OAAQC,OAAO,KAAO,aAAa,CACnC,MAAO,iBAAiB,CAAC,6IAEzB,GAAMC,SAAiC,CAAG,QAApCA,SAAiC,CAAIC,KAAK,CAAK,CACjD,sBAAgBR,KAAK,CAACS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